self.onmessage = function (e) {
    const { type, data } = e.data;
    if (type === 'PROCESS_CHUNKS') {
        self.postMessage({
            type: 'CHUNK_HASH_COMPLETE',
            data: {
                chunks: data.chunks.map((chunk, i) => ({
                    chunk,
                    hash: data.fileHash + '-' + i,
                    index: i,
                    percentage: 0,
                    size: chunk.size
                })),
                fileHash: data.fileHash,
                fileName: data.fileName,
                fileType: data.fileType
            }
        });
    }
};